Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 

27 строки
839 B

  1. import { NextResponse } from 'next/server';
  2. import { getJob, cancelJob } from '@/lib/transcode';
  3. export const dynamic = 'force-dynamic';
  4. type Ctx = { params: Promise<{ id: string }> };
  5. export async function GET(_req: Request, ctx: Ctx) {
  6. const { id } = await ctx.params;
  7. const job = await getJob(id);
  8. if (!job) return NextResponse.json({ error: 'Job not found' }, { status: 404 });
  9. return NextResponse.json({
  10. id: job.id,
  11. status: job.status,
  12. progress: job.progress,
  13. error: job.error,
  14. outputName: job.outputName,
  15. });
  16. }
  17. export async function DELETE(_req: Request, ctx: Ctx) {
  18. const { id } = await ctx.params;
  19. const ok = await cancelJob(id);
  20. if (!ok) return NextResponse.json({ error: 'Cannot cancel (not found or already finished)' }, { status: 404 });
  21. return NextResponse.json({ success: true });
  22. }